using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace fenk.Admin.Vencimientos
{
    public partial class RegistrarVencimientos : mvLibrary.BaseForm
    {
        public RegistrarVencimientos()
        {
            InitializeComponent();
        }
        public override void AfterReadItem()
        {
            base.AfterReadItem();
            // limpiar controles
            radioButton1.Checked = false;
            radioButton2.Checked = false;
            radioButton3.Checked = false;
            radioButton4.Checked = false;
            //
            this.textFecha.Font = new Font("Courier New", 8.25f);
            this.textImporte.Font = new Font("Courier New", 8.25f);
            this.txtColumna1.Font = new Font("Courier New", 8.25f);
            this.txtColumna2.Font = new Font("Courier New", 8.25f);
            this.labelAuditor.Font = new Font("Courier New", 8.25f);
            this.labelVB.Font = new Font("Courier New", 8.25f);
            textFecha.ReadOnly = false;
            textImporte.ReadOnly = false;
            labelAviso.Visible = false;
            //
            // registros ya auditados no permiten modificar fecha o importe
            //
            switch (UserLevel)
            {
                case "0":
                    if(Item.get_Text(10) != "" || Item.get_Text(11) !="")
                    {
                        textFecha.ReadOnly = true;
                        textImporte.ReadOnly = true;
                        labelAviso.Visible = true;
                    }
                    break;
                case "1":
                    // supervisor (visto bueno)
                    groupVB.Visible = true;
                    if (Item.get_Text(10) != "")
                    {
                        textFecha.ReadOnly = true;
                        textImporte.ReadOnly = true;
                        labelAviso.Visible = true;
                    }
                    break;
                case "2":
                    // auditor
                    groupAuditor.Visible = true;
                    break;
            }
            
        }
        private void panelData_Paint(object sender, PaintEventArgs e)
        {

        }

        private void mvLabel5_Click(object sender, EventArgs e)
        {

        }

        private void labelAuditor_Click(object sender, EventArgs e)
        {

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            // FIRMAR VB
            if (radioButton1.Checked)
            {
                Item[11] = User;
                labelVB.Text = User;
            }
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            // ANULAR VB
            if (radioButton2.Checked)
            {
                if (Item.get_Text(11) == User)
                {
                    Item[11] = "";
                    labelVB.Text = "";
                }
            }
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            // FIRMA AUDITOR
            if (radioButton3.Checked)
            {
                Item[10] = User;
                labelAuditor.Text = User;
            }
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            // ANULAR FIRMA AUDITOR
            if (radioButton4.Checked)
            {
                if (Item.get_Text(10) == User)
                {
                    Item[10] = "";
                    labelAuditor.Text = "";
                }
            }
        }

    }
}

